package lab02.test11;

public class Rectangle implements Printx {
    @Override
    public void printMyWay() {
        System.out.println("边长"+a+"和"+b);
        System.out.println("周长是："+perimeter(a,b));
        System.out.println("面积是："+area(a,b));
    }
    double a;
    double b;

    @Override
    public void setA(double A) { this.a=a ;}

    @Override
    public double getA() { return a;}
    public void setB(double b) { this.b=b;}



    @Override
    public double getB() { return b;}

    @Override
    public double area(double a, double b) { return a*b; }

    @Override
    public double perimeter(double a, double b) { return 2*(a+b); }



    @Override
    public void diagonal(double a, double b) {
        System.out.println("对角线长："+Math.sqrt(a*a+b*b));
    }


}
